<?php defined('BASEPATH') OR exit('No direct script access allowed');
 
use OSS\OssClient;
use OSS\Core\OssException;
 
/**
 * 阿里云OSS存储公共库
 */
class Aliyun_oss
{
 
    private $CI_instance;
    private $_oss;
 
    function __construct()
    {
        $this->CI_instance =& get_instance();
        //$this->CI_instance->load->config('business/aliyun');
        $config = $this->CI_instance->config->item('oss');
 
        if (isset($this->_oss)) {
            return $this->_oss;
        }
        $this->_oss = new OssClient(
            $config['accessKeyId'],
            $config['accessKeySecret'],
            $config['endpoint']
        );
    }
 
    /**
     * 使用魔术方法捕获所有未注册方法
     * @param  [type] $method    [调用的方法名]
     * @param  [type] $param_arr [调用这个方法所传递的参数]
     * @return [type]            [description]
     */
    public function __call($method, $param_arr)
    {
        return call_user_func_array(array($this->_oss, $method), $param_arr);
    }
 
}